package com.xiaoxu.media.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author xiaoxu
 * @version 1.0
 * @description Minio 配置类
 * @date 2023/1/21 13:08
 */
@Configuration
public class MinioConfig {

 /**
  * 读取url
  */
 @Value("${minio.endpoint}")
 private String endpoint;
 /**
  * 读取账户
  */
 @Value("${minio.accessKey}")
 private String accessKey;
 /**
  * 读取密码
  */
 @Value("${minio.secretKey}")
 private String secretKey;

 @Bean
 public MinioClient minioClient() {
  //返回minio构建器
  return MinioClient.builder()
          .endpoint(endpoint)
          .credentials(accessKey, secretKey)
          .build();
 }


}
